#!/usr/bin/env python
# coding=utf-8
class Fib(object):

    """Docstring for Fib. """

    def __init__(self,n):
        """TODO: to be defined. """
        self.prev = 0
        self.cur = 1
        self.n = n
    def __iter__(self):
        return self
        
    def __next__(self):
        if self.n > 0:
           self.prev, self.cur = self.cur, self.cur + self.prev
           self.n -= 1
           return self.cur
        else:
            raise StopIteration()


f = Fib(10)
print(f)
print(next(f))
print(next(f))
print(next(f))
print(next(f))

f1 = Fib(10)
print(f1)
print([i for i in f1])
